package com.huawei.appmarket.framework.widget;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.ImageView;
import androidx.annotation.Nullable;
import com.huawei.appgallery.foundation.ui.css.CSSRule;
import com.huawei.appgallery.foundation.ui.css.CSSViewProxy;
import com.huawei.appgallery.foundation.ui.css.RenderListener;
import com.huawei.appgallery.foundation.ui.css.adapter.CSSPropertyName;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSMonoColor;
import com.huawei.appgallery.foundation.ui.css.adapter.type.CSSValue;
import o.epo;
import o.ewm.e;

public class ArrowImageView extends ImageView implements RenderListener {
    private Drawable ˎ;
    private Drawable ˏ;

    public ArrowImageView(Context context) {
        super(context);
    }

    public ArrowImageView(Context context, @Nullable AttributeSet attributeSet) {
        super(context, attributeSet);
        ˊ(context);
    }

    public ArrowImageView(Context context, @Nullable AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        ˊ(context);
    }

    private void ˊ(Context context) {
        this.ˏ = context.getResources().getDrawable(e.ॱʻ);
        this.ˎ = context.getResources().getDrawable(e.ˏˏ);
    }

    public void setArrowUp(boolean z) {
        if (z) {
            setBackground(this.ˏ);
        } else {
            setBackground(this.ˎ);
        }
    }

    public void setArrowDrawable(Drawable drawable, Drawable drawable2) {
        this.ˏ = drawable;
        this.ˎ = drawable2;
    }

    public boolean onRenderReady(CSSViewProxy cSSViewProxy) {
        CSSRule rule = cSSViewProxy.getRule();
        if (rule.getStyleDeclaration() == null) {
            return false;
        }
        CSSValue propertyValue = rule.getStyleDeclaration().getPropertyValue(CSSPropertyName.BACKGROUND_TINT);
        if (propertyValue == null || !(propertyValue instanceof CSSMonoColor)) {
            return false;
        }
        int color = ((CSSMonoColor) propertyValue).getColor();
        this.ˏ = epo.ॱ(this.ˏ, color);
        this.ˎ = epo.ॱ(this.ˎ, color);
        return true;
    }
}
